;;; Kvantum package for GNU Guix.
;;; Copyright © 2021 florhizome <florhizome@posteo.net>
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;;
;;; This file is NOT part of GNU Guix.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages kvantum)
  #:use-module (guix git-download)
  #:use-module (guix build-system qt)
  #:use-module ((guix licenses)  #:prefix license:)
  #:use-module ((guix utils) #:select (substitute-keyword-arguments))
  #:use-module (guix download)
  #:use-module (gnu packages base)
  #:use-module (guix build utils)
  #:use-module (gnu packages xorg)
  #:use-module (guix packages)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages kde-frameworks))

(define-public kvantum
  (package
    (name "kvantum")
    (version "1.0.0")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://github.com/tsujan/Kvantum")
         (commit (string-append "V" version))))
       (sha256
        (base32 "0yvxj7r9z890nfq5cadw7ys144c2mnvaplvx4v4ndv7238b741l8"))))
    (build-system qt-build-system)
    (native-inputs
     (list qtbase-5 qttools pkg-config))
    (inputs
     (list libx11 libxext qtx11extras qtsvg kwindowsystem))
    (arguments
     `(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'correct-directory
           (lambda _
             (display (find-files "."))
             (copy-recursively "./Kvantum" ".")
             (delete-file-recursively "./Kvantum")))
         (add-after 'patch-source-shebangs 'alter-target-dirs
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out")))
               (substitute* (find-files "style/CMakeLists.txt")
                 (("\\$\\{_Qt5_PLUGIN_INSTALL_DIR\\}")
                  (string-append out "/lib/qt5/plugins")))
               (substitute* (find-files "style/CMakelists.txt")
                 (("\\$\\{QT_PLUGINS_DIR\\}")
                  (string-append out "/lib/qt5/plugins")))))))))
    (home-page "https://www.github.com/tsujan/kvantum")
    (synopsis "SVG-based theme engine for Qt")
    (description
"@code{kvantum} has a default dark theme, which is inspired by the default theme
of Enlightenment, but it goes far beyond its default theme: you could
make themes with very different looks and feels for it, whether they be
photorealistic or cartoonish, 3D or flat, embellished or minimalistic,
or something in between, and Kvantum will let you control almost every
aspect of Qt widgets.")
    (license license:gpl3+)))

